import sqlite3

def some_rule(line):
    # 判断规则，这里假设规则是行数是奇数
    return "GNGGA" in line

if __name__ == '__main__':
    conn = sqlite3.connect('C:/Users/Administrator/Desktop/1677903915312.db')
    cursor = conn.cursor()

    with open('C:/Users/Administrator/Desktop/RTKs.txt', 'r') as f:
        for line in f:
            arr=str(line).split(",")
            lat=arr[2]
            lon=arr[4]

            yy=arr[2].split(".")        #纬度
            xx=arr[4].split(".")        #经度

            y=yy[0]
            x=xx[0]

            a=y[0:2]+"."+y[-2:]+"."+yy[1][0:5]

            b=x[0:3]+"."+x[-2:]+"."+xx[1][0:5]
            cursor.execute("INSERT INTO com_core_bean_GNGGA (Lat, Lon) VALUES (?, ?)", (str(lat),str(lon)))
    conn.commit()
    conn.close()
    print("aaa")
